using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace MasterLab
{
	public partial class frmFertilidadFosforoOlsenABS: Form
	{
        public frmFertilidadFosforoOlsenABS()
		{
			InitializeComponent();
		}

        private void frmFertilidadFosforoABS_Load(object sender, EventArgs e)
        {
        
        }

        private void btnAceptar_Click(object sender, EventArgs e)
        {
            double[] x = { 100, 84.8, 74, 55, 20 };
            double[] y ={ 0, 0.10, 0.20, 0.40, 1.00 };

            double lectura = Double.Parse(txtLectura.Text);

            regresion re = new regresion(x, y, lectura);

            double r1 = re.r();
            double b = re.b();
            double m = re.m();
            double z = re.z();
            txtR.Text = "" + r1;
            txtB.Text = "" + b;
            txtM.Text = "" + m;
            txtLecturaPmm.Text = "" + z;

            //FORMULA PMM

            double lecppm = Double.Parse(txtLecturaPmm.Text);
            double alicuota = Double.Parse(cbAlicuota.Text);
            double dilucion = Double.Parse(txtDilucion.Text);

            double fppm = Math.Round((lecppm * dilucion) / alicuota, 3);
            double meg = Math.Round((fppm / 31.65), 3);
        }

        private void mandarTab(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
                SendKeys.Send("{TAB}");
        }
	}
}